/** 
 * Project Name:qfhy 
 * File Name:UserService.java 
 * Package Name:com.wf.qfhy.service.impl 
 * Date:2017年4月27日下午1:56:42 
 * Copyright (c) 2017, wxwj All Rights Reserved. 
 */
package com.wf.qfhy.service.impl;

import javax.annotation.Resource;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.wf.qfhy.dao.IBaseDao;
import com.wf.qfhy.dao.IUserDao;
import com.wf.qfhy.domain.UserDomain;
import com.wf.qfhy.entity.User;
import com.wf.qfhy.service.IUserService;

/**
 * @ClassName: UserService
 * @Description:
 * @author 王飞
 * @date 2017年4月27日 下午1:56:42
 */
@Service
@Transactional(rollbackFor = Throwable.class)
public class UserService extends BaseService implements IUserService {
	@Resource
	private IUserDao userDao;

	@SuppressWarnings("unchecked")
	@Override
	public IBaseDao<User> getBaseDao() {
		return userDao;
	}

	@Override
	public UserDomain doGetUserDomainByUserName(String userName) {
		UserDomain userDomain = new UserDomain();
		String hql = "from User where userName ='" + userName + "'";
		User user = userDao.find(hql).get(0);
		BeanUtils.copyProperties(user, userDomain);
		return userDomain;
	}

}
